package com.cjr.mq.complex;

import com.rabbitmq.client.AMQP;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitConfig1 {
    public final static String QUEUE = "testQueue";
    public final static String EXCHANGE = "fanout_exchange";

    @Bean
    Queue testQueue(){
        return new Queue(QUEUE,true,false,false);
    }

    @Bean
    FanoutExchange testExchange(){
        return new FanoutExchange(EXCHANGE,true,false);
    }

    @Bean
    Binding bindingQueue(){
        return  BindingBuilder.bind(testQueue()).to(testExchange());
    }

}
